Fix xm new -F -- this fix was recently introduced for xm create.
authorEwan Mellor <ewan@xensource.com>
Wed, 29 Nov 2006 12:16:19 +0000 (12:16 +0000)
committerEwan Mellor <ewan@xensource.com>
Wed, 29 Nov 2006 12:16:19 +0000 (12:16 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/new.py

index fec2fc76e66a072c521434656c63654734b6fabc..7af65510a97ec6d85350274100d5d9d2f7d6237c 100644 (file)
@@ -58,6 +58,12 @@ def main(argv):
     if not opts:
         return
 
+    if type(config) == str:
+        try:
+            config = sxp.parse(file(config))[0]
+        except IOError, exn:
+            raise OptionError("Cannot read file %s: %s" % (config, exn[1]))
+
     if opts.vals.dryrun:
         PrettyPrint.prettyprint(config)
     else: